<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>时间戳工具</title>
    </head>
    <body>
        时间戳（毫秒）：<h1></h1>
        时间戳（秒）：<h1></h1>
        <button id="refresh" style="width: 100px;height: 50px;">刷新</button>
    </body>
    <script>
        window.onload = function() {
            document.getElementById('refresh').onclick = function() {
                getTimeStamp()
            }
            getTimeStamp()
        }

        function getTimeStamp() {
            document.querySelectorAll('h1')[0].innerText = Date.now();
            document.querySelectorAll('h1')[1].innerText = Math.round(new Date() / 1000)
        }
    </script>
</html>
